#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 15, mod = 1e8;

int n, m;
int a[N];
int f[N][1 << N];
vector<int> ok;

void init()
{
    for (int st = 0;st < (1 << m);st++)
        if ((st & ((st << 1) | (st >> 1))) == 0)
            ok.push_back(st);
}

bool check(int st, int mark) { return ((st | mark) ^ mark) == 0; }

void solve()
{
    cin >> n >> m;
    init();
    for (int i = 1;i <= n;i++)
        for (int j = 0;j < m;j++) {
            int x; cin >> x;
            a[i] |= (x << j);
        }
    f[0][0] = 1;
    for (int i = 1;i <= n;i++)
        for (int now : ok) if (check(now, a[i]))
            for (int pre : ok) if (check(pre, a[i - 1])) {
                if ((now & pre) == 0)
                    (f[i][now] += f[i - 1][pre]) %= mod;
            }

    int ans = 0;
    for (int st : ok) if (check(st, a[n])) (ans += f[n][st]) %= mod;
    cout << ans << "\n";
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"(2 3
1 1 1
0 1 0
)");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}